import greenfoot.*;
import java.awt.Color;

/**
 *Its the world where the skydiver are going to play stratos fear 
 * 
 * @author Carlos Andrés Olea Reyes
 */
public class World1 extends ScrollWorld
{
    private GreenfootSound worldSound= new GreenfootSound("world_1_stage.mp3");
    private Puntaje puntaje1=new Puntaje();//Score
    private PuntajeV puntaje2=new PuntajeV();//vidas
    private Altura altura1=new Altura();
    private Letrero Letrero1=new Letrero("Score");
    private Letrero Letrero2=new Letrero("Altura");
    private Letrero Letrero3=new Letrero("Vidas");
    private Paracaidista jugador=new Paracaidista();

    /**
     * Aqui se crea el primer mundo y se inicializan todos los anillos y obstaculos 
     * del juego
     */
    public World1()
    {
        super(600,400, 1, 600, 7000);
       prepare();
    }
    public void act()
    {
     worldSound.playLoop();
    }
    
    
    /**
     * prepara la creacion de los obstaculos y anillos del primer mundo
     */
    private void prepare()
    {

        addCameraFollower(jugador, 300, 0); 
        addCameraFollower(puntaje1,-276,-129);
        addCameraFollower(Letrero1,-276,-159);
        addCameraFollower(Letrero2,-276,-99);
        addCameraFollower(altura1,-276,-69);
        addCameraFollower(Letrero3,-276,-39);
        addCameraFollower(puntaje2,-276,-9);
        addObject(new Redring(),100,555);
        addObject(new Redring(),200,2221);
        addObject(new Redring(),50,3886); 
        addObject(new YellowRing(),110,1111);
        addObject(new YellowRing(),500,2776);
        addObject(new YellowRing(),300,4441);
        addObject(new BLuering(),200,1666  );
        addObject(new BLuering(),500,3331  );
        addObject(new BLuering(),300,4996);

        BLuering bluering4 = new BLuering();
        addObject(bluering4, 114, 828);
        YellowRing yellowring4 = new YellowRing();
        addObject(yellowring4, 122, 1440);
        BLuering bluering5 = new BLuering();
        addObject(bluering5, 529, 1917);
        BLuering bluering6 = new BLuering();
        addObject(bluering6, 41, 2611);
        YellowRing yellowring5 = new YellowRing();
        addObject(yellowring5, 463, 3596);
        BLuering bluering7 = new BLuering();
        addObject(bluering7, 58, 4209);
        Redring redring5 = new Redring();
        addObject(redring5, 276, 4726);
        Cloud cloud = new Cloud();
        addObject(cloud, 112, 1313);
        Cloud cloud2 = new Cloud();
        addObject(cloud2, 454, 1451);
        Cloud cloud3 = new Cloud();
        addObject(cloud3, 322, 2015);
        Cloud cloud4 = new Cloud();
        addObject(cloud4, 430, 1779);
        Cloud cloud5 = new Cloud();
        addObject(cloud5, 223, 4084);
        Cloud cloud6 = new Cloud();
        addObject(cloud6, 497, 4661);
        Hotairballon hotairballon = new Hotairballon();
        addObject(hotairballon, 118, 4683);
        Hotairballon hotairballon2 = new Hotairballon();
        addObject(hotairballon2, 449, 2342);
        Hotairballon hotairballon3 = new Hotairballon();
        addObject(hotairballon3, 452, 1072);
        Hotairballon hotairballon4 = new Hotairballon();
        addObject(hotairballon4, 435, 5226);
        SilverRing silverring = new SilverRing();
        addObject(silverring, 291, 1237);
        SilverRing silverring2 = new SilverRing();
        addObject(silverring2, 282, 3086);
        SilverRing silverring3 = new SilverRing();
        addObject(silverring3, 338, 5704);
        Bird bird = new Bird();
        addObject(bird, 467, 5510);
        Bird bird2 = new Bird();
        addObject(bird2, 493, 5755);
        removeObject(cloud);
        removeObject(cloud2);
        removeObject(cloud4);
        removeObject(cloud3);
        hotairballon3.setLocation(547, 1040);
        hotairballon2.setLocation(547, 2218);
        cloud5.setLocation(213, 4093);
        removeObject(cloud5);
        removeObject(cloud6);
        hotairballon.setLocation(451, 4654);
        hotairballon.setLocation(547, 4616);
        hotairballon4.setLocation(552, 5208);
        removeObject(bird2);
        removeObject(bird);
        Hotairballon hotairballon5 = new Hotairballon();
        addObject(hotairballon5, 558, 1603);
        hotairballon5.setLocation(552, 1606);
        Hotairballon hotairballon6 = new Hotairballon();
        addObject(hotairballon6, 553, 2852);
        Hotairballon hotairballon7 = new Hotairballon();
        addObject(hotairballon7, 553, 4003);
        Hotairballon hotairballon8 = new Hotairballon();
        addObject(hotairballon8, 554, 6013);
        hotairballon8.setLocation(551, 6013);
        BLuering bluering8 = new BLuering();
        addObject(bluering8, 255, 5504);
        BLuering bluering9 = new BLuering();
        addObject(bluering9, 68, 6319);
        Redring redring6 = new Redring();
        addObject(redring6, 557, 3177);
        redring5.setLocation(546, 3046);
        redring5.setLocation(540, 3082);
        removeObject(redring5);
        SilverRing silverring4 = new SilverRing();
        addObject(silverring4, 300, 4711);
        SilverRing silverring5 = new SilverRing();
        addObject(silverring5, 399, 362);
        SilverRing silverring6 = new SilverRing();
        addObject(silverring6, 499, 262);    
        silverring6.setLocation(108, 236);
    }

    /**
     *se regresa un puntaje del mundo 
     */
    public Puntaje getPuntaje1()
    {
     return puntaje1;
    }
    /**
     * Se regresa el puntaje de las vidas para que se pueda manipular por quien lo necesite
     */
    public PuntajeV getPuntaje2()
    {
     return puntaje2;
    }
    /**
     * Se regresa un objeto de la clase paracaidista para que se manipule
     */
    public Paracaidista getJugador()
    {
    return jugador;
    }
    /**
     * Se regresa un objeto de la clase Altura para que se manipule
     */
    public Altura getAltura1()
    {
    return altura1;
    }
    /**
     * Se detiene el sonido de fondo del mundo
     */
    public void detenSonido()
    {
    worldSound.stop();
    }
    /**
     * Se detiene la musica del juego y se reanuda cuando se le da clic en el boton play
     */
    public void stopped()
    {
    worldSound.pause();
    }
    public void level_1()
    {
    addObject(new Redring(),100,555);
        addObject(new Redring(),200,2221);
        addObject(new Redring(),50,3886); 
        addObject(new YellowRing(),110,1111);
        addObject(new YellowRing(),500,2776);
        addObject(new YellowRing(),300,4441);
        addObject(new BLuering(),200,1666  );
        addObject(new BLuering(),500,3331  );
        addObject(new BLuering(),300,4996);
        BLuering bluering4 = new BLuering();
        addObject(bluering4, 114, 828);
        YellowRing yellowring4 = new YellowRing();
        addObject(yellowring4, 122, 1440);
        BLuering bluering5 = new BLuering();
        addObject(bluering5, 529, 1917);
        BLuering bluering6 = new BLuering();
        addObject(bluering6, 41, 2611);
        YellowRing yellowring5 = new YellowRing();
        addObject(yellowring5, 463, 3596);
        BLuering bluering7 = new BLuering();
        addObject(bluering7, 58, 4209);
        Redring redring5 = new Redring();
        addObject(redring5, 276, 4726);
        SilverRing silverring = new SilverRing();
        addObject(silverring, 291, 1237);
        SilverRing silverring2 = new SilverRing();
        addObject(silverring2, 282, 3086);
        SilverRing silverring3 = new SilverRing();
        addObject(silverring3, 338, 5704);
        
    }
    /**
     * Este metodo crea los enemigos y anillos del siguiente nivel del juego
     */
    public void level_2()
    {
        Cloud cloud = new Cloud();
        addObject(cloud, 155, 624);
        Cloud cloud2 = new Cloud();
        addObject(cloud2, 486, 1236);
        Cloud cloud3 = new Cloud();
        addObject(cloud3, 58, 2332);
        Cloud cloud4 = new Cloud();
        addObject(cloud4, 72, 3328);
        Cloud cloud5 = new Cloud();
        addObject(cloud5, 516, 4129);
        Redring redring = new Redring();
        addObject(redring, 53, 741);
        Redring redring2 = new Redring();
        addObject(redring2, 47, 1132);
        YellowRing yellowring = new YellowRing();
        addObject(yellowring, 156, 279);
        YellowRing yellowring2 = new YellowRing();
        addObject(yellowring2, 63, 1607);
        YellowRing yellowring3 = new YellowRing();
        addObject(yellowring3, 73, 1929);
        YellowRing yellowring4 = new YellowRing();
        addObject(yellowring4, 71, 2255);
        BLuering bluering = new BLuering();
        addObject(bluering, 59, 2102);
        BLuering bluering2 = new BLuering();
        addObject(bluering2, 48, 1702);
        BLuering bluering3 = new BLuering();
        addObject(bluering3, 60, 2625);
        YellowRing yellowring5 = new YellowRing();
        addObject(yellowring5, 68, 3021);
        SilverRing silverring = new SilverRing();
        addObject(silverring, 320, 2782);
        SilverRing silverring2 = new SilverRing();
        addObject(silverring2, 153, 3461);
        SilverRing silverring3 = new SilverRing();
        addObject(silverring3, 461, 3541);
        Redring redring3 = new Redring();
        addObject(redring3, 163, 3996);
        Redring redring4 = new Redring();
        addObject(redring4, 120, 4421);
        Redring redring5 = new Redring();
        addObject(redring5, 358, 4753);
        Redring redring6 = new Redring();
        addObject(redring6, 107, 5108);
        Redring redring7 = new Redring();
        addObject(redring7, 90, 5612);
        SilverRing silverring4 = new SilverRing();
        addObject(silverring4, 296, 5326);
        SilverRing silverring5 = new SilverRing();
        addObject(silverring5, 302, 5846);
    }
    /**
     * Se crean los obstaculos y anillos del 3er y ultimo nivel
     */
    public void level3()
    {
        //System.out.println("entro?");
        Bird bird = new Bird();
        addObject(bird, 469, 185);
        Bird bird2 = new Bird();
        addObject(bird2, 81, 576);
        Bird bird3 = new Bird();
        addObject(bird3, 537, 970);
        Bird bird4 = new Bird();
        addObject(bird4, 75, 1427);
        Bird bird5 = new Bird();
        addObject(bird5, 532, 1933);
        Bird bird6 = new Bird();
        addObject(bird6, 23, 2485);
        BLuering bluering = new BLuering();
        addObject(bluering, 86, 453);
        BLuering bluering2 = new BLuering();
        addObject(bluering2, 105, 665);
        BLuering bluering3 = new BLuering();
        addObject(bluering3, 102, 892);
        BLuering bluering4 = new BLuering();
        addObject(bluering4, 550, 1139);
        BLuering bluering5 = new BLuering();
        addObject(bluering5, 547, 1327);
        BLuering bluering6 = new BLuering();
        addObject(bluering6, 553, 1548);
        SilverRing silverring = new SilverRing();
        addObject(silverring, 151, 1902);
        SilverRing silverring2 = new SilverRing();
        addObject(silverring2, 339, 2056);
        SilverRing silverring3 = new SilverRing();
        addObject(silverring3, 523, 2165);
        SilverRing silverring4 = new SilverRing();
        addObject(silverring4, 123, 2305);
        SilverRing silverring5 = new SilverRing();
        addObject(silverring5, 348, 2466);
        SilverRing silverring6 = new SilverRing();
        addObject(silverring6, 526, 2575);
        YellowRing yellowring = new YellowRing();
        addObject(yellowring, 71, 3808);
        YellowRing yellowring2 = new YellowRing();
        addObject(yellowring2, 540, 3990);
        Redring redring = new Redring();
        addObject(redring, 44, 4448);
        Redring redring2 = new Redring();
        addObject(redring2, 305, 4612);
        Redring redring3 = new Redring();
        addObject(redring3, 548, 4793);
    }
    public GreenfootSound getSound()
    {
    return worldSound;
    }
    
}